# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidManagement.V1.Model.BatchUsageLogEvents do
  @moduledoc """
  Batched event logs of events from the device.

  ## Attributes

  *   `device` (*type:* `String.t`, *default:* `nil`) - If present, the name of the device in the form ‘enterprises/{enterpriseId}/devices/{deviceId}’
  *   `retrievalTime` (*type:* `DateTime.t`, *default:* `nil`) - The device timestamp when the batch of events were collected from the device.
  *   `usageLogEvents` (*type:* `list(GoogleApi.AndroidManagement.V1.Model.UsageLogEvent.t)`, *default:* `nil`) - The list of UsageLogEvent that were reported by the device, sorted chronologically by the event time.
  *   `user` (*type:* `String.t`, *default:* `nil`) - If present, the resource name of the user that owns this device in the form ‘enterprises/{enterpriseId}/users/{userId}’.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :device => String.t() | nil,
          :retrievalTime => DateTime.t() | nil,
          :usageLogEvents => list(GoogleApi.AndroidManagement.V1.Model.UsageLogEvent.t()) | nil,
          :user => String.t() | nil
        }

  field(:device)
  field(:retrievalTime, as: DateTime)
  field(:usageLogEvents, as: GoogleApi.AndroidManagement.V1.Model.UsageLogEvent, type: :list)
  field(:user)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidManagement.V1.Model.BatchUsageLogEvents do
  def decode(value, options) do
    GoogleApi.AndroidManagement.V1.Model.BatchUsageLogEvents.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidManagement.V1.Model.BatchUsageLogEvents do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
